I found the root cause. One of the popover view's subviews was my custom NSView which overrides drawRect method:
- (void) drawRect:(NSRect)dirtyRect
{
NSLog(@"DIRTY RECT: %@", NSStringFromRect(dirtyRect));
[colorSeparator setFill];
NSRectFill(dirtyRect);
[super drawRect:dirtyRect];
}
but it gets weird rect as parameter:
DIRTY RECT: {{-13, -56}, {426, 476}}
DIRTY RECT: {{-13, -411}, {426, 476}}
So I just removed that method and set the background color via layer:
@implementation CDSeparatorView
- (instancetype) init
{
self = [super init];
if (self)
{
[self setupInstance];
}
return self;
}
- (instancetype) initWithFrame:(NSRect)frameRect
{
self = [super initWithFrame:frameRect];
if (self)
{
[self setupInstance];
}
return self;
}
- (instancetype) initWithCoder:(NSCoder*)coder
{
self = [super initWithCoder:coder];
if (self)
{
[self setupInstance];
}
return self;
}
- (void) setupInstance
{
self.translatesAutoresizingMaskIntoConstraints = NO;
self.wantsLayer = YES;
self.layer.backgroundColor = SREG.theme.colorSeparator.CGColor;
}
@end
and now the app is drawing the content just fine.
Topic:
App & System Services
SubTopic:
Core OS
Tags: